import { callnumberGetQueueTWO, callnumberPushTWO } from "@/api/SecondmentDictionary";
import "./index.less";
import { Button, List, message, Typography } from "antd";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
// import { BasicForm, FormSchema, useForm } from "@/components/Form";

const { Item } = List;
const { Text } = Typography;
const deptId = "125";
const index = () => {
	const { t } = useTranslation();
	const [data, setData] = useState([]);
	const callnumberFn = async () => {
		const res = await callnumberPushTWO(deptId);
		if (res) {
			message.success(t("kevin_ui.numberSuccessful") + res);
			getCallnumberGetQueueTWO();
			return;
		}
		message.error(t("kevin_ui.numberFailed"));
	};
	const getCallnumberGetQueueTWO = () => {
		callnumberGetQueueTWO(deptId).then(res => {
			setData(res);
		});
	};

	useEffect(() => {
		getCallnumberGetQueueTWO();
	}, []);
	return (
		<div className="callNumber">
			<List
				header={
					<div className="header">
						<h3>{t("kevin_ui.number")}</h3>
						<Button type="primary" onClick={callnumberFn}>
							{t("kevin_ui.offerNumber")}
						</Button>
					</div>
				}
				size="default"
				dataSource={data}
				renderItem={(item, index) => (
					<Item>
						<Text type="success">
							[{t("kevin_ui.lineUp")}
							{index + 1}]
						</Text>{" "}
						{item}
					</Item>
				)}
			/>
		</div>
	);
};
export default index;
